<?php

// -----------------------------------------------------------------------------

include_once "configAuth/config.php";

// -----------------------------------------------------------------------------

$inputedUserName = false;
$inputedPassword = false;
$correctUserName = false;
$correctPassword = false;

if (isset($_COOKIE[$cookieUsername])) {

    $inputedUserName = true;

    if ($_COOKIE[$cookieUsername] == hash("sha256", $username)) {
        $correctUserName = true;
    }

}

if (isset($_COOKIE[$cookiePassword])) {
    
    $inputedPassword = true;

    if ($_COOKIE[$cookiePassword] == hash("sha256", $password)) {
        $correctPassword = true;
    }
    
}

if ($inputedUserName && $inputedPassword && $correctUserName && $correctPassword) {
    // do nothing;
} else {

    $str = <<<BBB
Location:login.php
BBB;

    header($str);
    exit;

}